import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { JobForm, JobQuery, JobPageResult } from './types';



/**
 * 获取用户分页列表
 *
 * @param queryParams
 */
export function getJobPage(
  queryParams: JobQuery
) {
  return request({
    url: '/api/sys/job/list',
    method: 'post',
    data: queryParams
  });
}



/**
 * 获取部门详情
 *
 * @param id
 */
export function getDeptForm(id: number): AxiosPromise<JobForm> {
  return request({
    url: '/api/v1/dept/' + id + '/form',
    method: 'get'
  });
}

/**
 * 新增部门
 *
 * @param data
 */
export function addJob(data: JobForm) {
  return request({
    url: '/api/sys/job/add',
    method: 'post',
    data: data
  });
}

/**
 *  修改部门
 *
 * @param id
 * @param data
 */
export function updateJob(id: number, data: JobForm) {
  return request({
    url: '/api/sys/job/update',
    method: 'post',
    data: data
  });
}

/**
 * 删除职位
 *
 * @param id
 */
export function deleteJob(id?: number) {
  return request({
    url: '/api/sys/job/delete',
    method: 'post',
    data: {
      id: id
    }
  });
}

/**
 * 批量删除职位
 *
 * @param id
 */
export function deleteListJob(ids: number[]) {
  return request({
    url: '/api/sys/job/batchdelete',
    method: 'post',
    data: {
      ids
    }
  });
}
